package com.northming.daytodo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


@EnableTransactionManagement
@SpringBootApplication
@EnableScheduling
public class App extends WebMvcConfigurerAdapter
{
    public static void main( String[] args )
    { 
    	SpringApplication.run(App.class, args);
    }
    
    @Bean
    public UserSecurityInterceptor userSecurityInterceptor(){
    	return new UserSecurityInterceptor();
    }
    
    public void addInterceptors(InterceptorRegistry registry) {  
        registry.addInterceptor(userSecurityInterceptor()).addPathPatterns("/**");  
    }  
}
